// JavaScript Document
function getXMLHttpRequest(){
	if(window.ActiveXObject){
		return new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest){
		return new XMLHttpRequest();	
	}else alert("Status : Can not create XMLHttpRequest Object");
}
var xmlhttp=getXMLHttpRequest();
//function to send data
function sendDataKomen(handlePage,ElementID){
	var id_komentar=document.getElementById('id_komentar').value;
	var id_berita=document.getElementById('id_berita').value;
		if(xmlhttp.readyState==4 || xmlhttp.readyState==0){
			var obj=document.getElementById(ElementID);
			var form=obj.innerHTML;
			obj.innerHTML='Saving data, please wait..';
			xmlhttp.open('POST',handlePage,true);
			xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			xmlhttp.onreadystatechange=function(){
				if(xmlhttp.readyState==4){
					if(xmlhttp.status==200){
						obj.innerHTML=xmlhttp.responseText+'<br>'+form;
					}else{
						alert('Error : '+xmlhttp.statusText);
					}
				}
			}
			var param='id_komentar='+id_komentar;
			param+='&id_berita='+id_berita;
			param+='&action=hapuskomentar';
			xmlhttp.send(param);
		}
}